--------------------------------- Zombified World hack --------------------------------

function ZWEzekAllowed(ent)
	if !(ent:IsValid()) then return false end 
	if (ent:GetClass() == nil) or (ent:GetClass() == "") or (string.find(ent:GetClass(), "physgun")) or (ent:GetOwner() == minge) then 
		return false 
	end
	if string.find(ent:GetClass(), "fists") or string.find(ent:GetClass(), "faction") or string.find(ent:GetClass(), "zw_bed") then
		return true
	else
		return false
	end
end

function EzekZWHack()
	ZWhackEnabled = true
	hook.Add("HUDPaint", "ZWhack", function()
		for _, ent in pairs(ents.GetAll()) do
			if ZWEzekAllowed(ent) then
				local rpepos = ent:GetPos()
				if rpepos:ToScreen().x > 0 and
				rpepos:ToScreen().y > 0 and
				rpepos:ToScreen().x < ScrW() and
				rpepos:ToScreen().y < ScrH() then
                local rppos1 = (ent:LocalToWorld( Vector(0,0,0)) ):ToScreen()
                   	draw.SimpleTextOutlined("Class: "..ent:GetClass(), "ScoreboardText", rppos1.x, rppos1.y, Color(0, 0, 255, 255), 2, 1, 1, Color(255, 255, 255, 255))
				end
			end
		end
	end)
end

concommand.Add("wots_togglezwhack", function()
    if ZWhackEnabled then
	    hook.Remove("HUDPaint", "ZWhack")
        SlobNotify("Zombified world mode: OFF")
		ZWhackEnabled = false
	elseif !ZWhackEnabled then
        EzekZWHack()
        SlobNotify("Zombified world Mode: ON")
		ZWhackEnabled = true
    end
end)

------------------------------------------------------------------------------